<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>slot插槽</title>
    <script src="lib/vue.js"></script>
</head>

<body>
    <div id="box">
        <child>

            <div>预定位，会显示在子组件的slot插槽里面</div>
            <div slot="havenameslot">具名插槽</div>
        </child>

    </div>

    <script>
        //定义自组件
        Vue.component("child", {
            template: `<div>
                child
                <!-- 不具名插槽 -->
                <slot></slot>

                <!-- 具名插槽 -->
                <slot name="havenameslot"></slot>
                </div>`
        })
        new Vue({
            el: "#box",
            data: [

            ]
        })
    </script>
</body>

</html>